package se.tinkerway.bomberman.view;

import glcore.view.GLApplication;

import java.awt.event.KeyEvent;

public class GLKeyboardInterface implements KeyboardInterface {
	GLApplication application;
	
	public GLKeyboardInterface(GLApplication application) {
		this.application = application;
	}
	
	@Override
	public boolean isKeyPressed(KEY_CODE keyCode) {
		
		Integer glKeyCode = null;
		
		switch (keyCode) {
			case LEFT:
				glKeyCode = KeyEvent.VK_LEFT;
				break;
			case RIGHT:
				glKeyCode = KeyEvent.VK_RIGHT;
				break;
			case UP:
				glKeyCode = KeyEvent.VK_UP;
				break;
			case DOWN:
				glKeyCode = KeyEvent.VK_DOWN;
				break;
			case BOMB:
				glKeyCode = KeyEvent.VK_SPACE;
				break;
		}
		
		if (glKeyCode != null) {
			return application.isKeyPressed(glKeyCode);
		} else {
			return false;
		}
	}

}
